<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="role-form">
				<div class="select-list">
					<ul>
						<li>
							旺旺号：<input type="text" name="wangwangNumber" id="wangwangNumber"/>
						</li>
						<li>
							联系方式：<input type="text" name="customerPhone" id="customerPhone"/>
						</li>
						<li>

						</li>



					</ul>
					<ul>
						<li class="select-time">
							<label>导入时间： </label>
							<input type="text" class="time-input" id="beginTime" placeholder="开始时间" name="beginTime"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="btn-group-sm" id="toolbar" role="group">

			<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="data:data:import">
				<i class="fa fa-upload"></i> 导入
			</a>
<!--			<a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="enter:enter:add">-->
<!--				<i class="fa fa-plus"></i> 录入-->
<!--			</a>-->
			<!--<a class="btn btn-primary " onclick="checkAllEnterForm()" shiro:hasPermission="enter:enter:checkAll">-->
				<!--<i class="fa fa-check"></i> 审核-->
			<!--</a>-->
			<a class="btn btn-warning" onclick="exportExcel()" >
				<i class="fa fa-download"></i> 导出
			</a>
			<a class="btn btn-danger btn-del disabled" onclick="batchDelete()" >
				<i class="fa fa-remove"></i> 删除
			</a>
		</div>

		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script th:inline="javascript">
    // var editFlag = [[${@permission.hasPermi('enter:enter:edit')}]];
	// var removeFlag = [[${@permission.hasPermi('enter:enter:remove')}]];
    var prefix = ctx + "data/data";



    $(function() {
        var options = {
            url: prefix + "/list",
            removeUrl: prefix + "/remove",
			importUrl: prefix + "/importData",
            uniqueId: "dataId",
            // exportUrl: prefix + "/export",
            // sortName: "roleSort",
            modalName: "数据模块",
            columns: [
				{
					checkbox: true
				},
                {
                    field: 'Number',
                    title: '序号',
                    formatter: function (value, row, index) {
                        return index + 1;
                    },
                },
                {
                    field: 'dataId',
                    title: '序号',
                    visible: false
                },
                {
                    field: 'customerName',
                    title: '客户姓名',
                },
                {
                    field: 'wangwangNumber',
                    title: '旺旺号',
                },
                {
                    field: 'productName',
                    title: '产品名称',
                },
                {
                    field: 'customerPhone',
                    title: '联系方式',
                },
                {
                    field: 'customerAddress',
                    title: '地址',
                },
                {
                    field: 'enterDate',
                    title: '导入时间',
                },
                {
                    field: 'createBy',
                    title: '操作人',
                }]
        };
        $.table.init(options);
    });


	/**
	 * 导出Exce表格
	 */
	function exportExcel(){

        window.location.href =prefix+'/exportExcel?wangwangNumber='+$("#wangwangNumber").val()+"&customerPhone="+$("#customerPhone").val() +"&beginTime="+$("#beginTime").val();
    }

	// 审核订单信息
	function batchDelete() {
		var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
		if (rows.length == 0) {
			$.modal.alertWarning("请至少选择一条记录");
			return;
		}
		$.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
			var url = prefix + "/remove";
			var data = { "dataIds": rows.join() };
			$.operate.submit(url, "post", "json", data);
		});
	}






</script>
</body>
<form id="importForm" enctype="multipart/form-data" class="mt20 mb10" style="display: none;">
	<div class="col-xs-offset-1">
		<input type="file" id="file" name="file"/>
		<!--<div class="mt10 pt5">-->
			<!--<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据-->
			<!--&nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>-->
		<!--</div>-->
		<font color="red" class="pull-left mt10">
			提示：仅允许导入“xls”或“xlsx”格式文件！
		</font>
	</div>
</form>
</html>